package com.example.qxfw.common.service.impl;

import com.example.qxfw.common.entity.FloodcontrolProject;
import com.example.qxfw.common.mapper.FloodcontrolProjectMapperXml;
import com.example.qxfw.common.service.FloodcontrolProjectService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.ArrayList;
import java.util.List;

/************************************
 *
 * @author : HuangDeYin Jolly
 * @since : JDK 11
 * @Date : 2023/7/8  星期六   15:38
 * @description : 此类用来
 ***************************************/
@Service
public class FloodcontrolProjectServiceImpl implements FloodcontrolProjectService {
    @Autowired
    private FloodcontrolProjectMapperXml floodcontrolProjectMapperXml;
    @Override
    public Integer save(final List<FloodcontrolProject> dataList) {
        List<Integer> result = new ArrayList<>();
        dataList.forEach(floodcontrolProject -> {
            int insertSelective = this.floodcontrolProjectMapperXml.insertSelective(floodcontrolProject);
            result.add(insertSelective);
        });
        if (result.contains(0)){
            return 0;
        }else {
            return 1;
        }
    }
}
